package br.com.agenda.entity;

import java.io.Serializable;

import javax.persistence.Embeddable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;

@Entity
@Table(name = "USUARIO_TAREFA")
public class UsuarioTarefaEntity implements Serializable {
	@EmbeddedId
	private UsuarioTarefaPK	pk;

	public UsuarioTarefaPK getPk() {
		return pk;
	}

	public void setPk(UsuarioTarefaPK pk) {
		this.pk = pk;
	}

	@Embeddable
	public class UsuarioTarefaPK implements Serializable {
		private Integer	codUsu;
		private Integer	codTarefa;

		public Integer getCodUsu() {
			return codUsu;
		}

		public void setCodUsu(Integer codUsu) {
			this.codUsu = codUsu;
		}

		public Integer getCodTarefa() {
			return codTarefa;
		}

		public void setCodTarefa(Integer codTarefa) {
			this.codTarefa = codTarefa;
		}

		@Override
		public int hashCode() {
			final int prime = 31;
			int result = 1;
			result = prime * result + getOuterType().hashCode();
			result = prime * result + ((codTarefa == null) ? 0 : codTarefa.hashCode());
			result = prime * result + ((codUsu == null) ? 0 : codUsu.hashCode());
			return result;
		}

		@Override
		public boolean equals(Object obj) {
			if (this == obj)
				return true;
			if (obj == null)
				return false;
			if (getClass() != obj.getClass())
				return false;
			UsuarioTarefaPK other = (UsuarioTarefaPK) obj;
			if (!getOuterType().equals(other.getOuterType()))
				return false;
			if (codTarefa == null) {
				if (other.codTarefa != null)
					return false;
			} else if (!codTarefa.equals(other.codTarefa))
				return false;
			if (codUsu == null) {
				if (other.codUsu != null)
					return false;
			} else if (!codUsu.equals(other.codUsu))
				return false;
			return true;
		}

		private UsuarioTarefaEntity getOuterType() {
			return UsuarioTarefaEntity.this;
		}
	}
}